package com.mgq.design.strategy.c1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.stream.Stream;

/**
 * <b>功能：</b>Client<br>
 * <b>Copyright mgq</b>
 * <li>版本&nbsp;&nbsp;&nbsp;&nbsp;修改日期&nbsp;&nbsp;&nbsp;&nbsp;部　　门&nbsp;&nbsp;&nbsp;&nbsp;作　者&nbsp;&nbsp;&nbsp;&nbsp;变更内容</li><hr>
 * <li>v1.0&nbsp;&nbsp;&nbsp;&nbsp;20220331&nbsp;&nbsp;营业后台&nbsp;&nbsp;&nbsp;&nbsp;马广奇&nbsp;&nbsp;&nbsp;&nbsp;创建类</li>
 * <br><br>
 *
 * @author 马广奇
 * @version 2022-03-31 15:27
 */
@SpringBootApplication
public class Client {
    public static void main(String[] args) {
        SpringApplication.run(Client.class);

        Stream<ShopReplication> stream = Stream.of(
                new ShopReplication("复制员工","EmpCopy"),
                new ShopReplication("复制客位","PointCopy"),
                new ShopReplication("复制POS","PosCopy")
        );

        stream.forEach(Client::accept);
    }

    private static void accept(ShopReplication shopReplication) {
        CopyAbstractTemplate copyStrategy = (CopyAbstractTemplate) CopyStrategyFactory.getCopyStrategy(shopReplication.getType());
        copyStrategy.copy(shopReplication);
    }
}
